using System;
using UnityEngine;

public class SensitivityChanger : MonoBehaviour
{
	private const float MAX_SENSIVITY = 24f;

	private UISlider slider;

	public float sensitivity;

	public static event Action OnSensitivityChanged;

	private void Awake()
	{
		slider = GetComponent<UISlider>();
		slider.value = BCWStorage.Get<float>(settings.keySensivity) / 24f - 0.1f;
		if (slider.value <= 0f)
		{
			slider.value = 0.4f;
		}
	}

	public void OnValueChange()
	{
		sensitivity = 24f * (slider.value + 0.1f);
		BCWStorage.Set(settings.keySensivity, sensitivity);
		if (SensitivityChanger.OnSensitivityChanged != null)
		{
			SensitivityChanger.OnSensitivityChanged();
		}
	}
}
